package com.cordershy.controller;

import com.cordershy.pojo.deposit;
import com.cordershy.service.depositService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class depositController {
    @Autowired
    depositService depositService;
    @RequestMapping("/deposit/selectAll")
    public List<deposit> selectAll(@RequestParam("username") String username){
        return depositService.selectAll(username);
    }
    @RequestMapping("/deposit/select")
    public deposit select(@RequestParam(value = "depositid") int depositid){
        return depositService.selectById(depositid);
    }
    @RequestMapping("/deposit/addDeposit")
    public void addDeposit(deposit deposit){
        depositService.addDeposit(deposit);
    }
    @RequestMapping("/deposit/updateDeposit")
    public void updateDeposit(deposit deposit){
        depositService.updateDeposit(deposit);
    }
    @RequestMapping("/deposit/deleteDeposit")
    public void deleteDeposit(@RequestParam(value = "depositid") int depositid){
        depositService.deleteDeposit(depositid);
    }
}
